import tensorflow as tf
import keras


class Residual(tf.keras.Model):
    def get_config(self):
        pass

    def call(self, inputs, training=None, mask=None):
        pass

    def __init__(self, module, half=False):
        super(Residual, self).__init__()
        self.net = module
        self.half = half

    def forward(self, inputs, **kwargs):
        x = self.net(inputs, **kwargs)

        if self.half:
            return (x * 0.5) + inputs
        else:
            return x + inputs
